home *** CD-ROM | disk | FTP | other *** search
- ;Simple super>fast>chip tester
- ;
- ;it's a bit flickery...me'thinks I've missed something with the smooth
- ;scroll thing...as it's the first time I've done soft scroll with this.
- ;
- ;it is also copying from the superbitmap everytime...which I don't think
- ;will always be nescerary.
- ;
- ;using this method, the edge 16 pixels of the superbitmap to the right
- ;and bottom...can't be shown, because the viewable area has a clip
- ;border, to clip any shapes you blit to it, and therefore, you need
- ;an extra shapewidth across, and shapeheight down, to make sure you can
- ;view the whole super bitmap. There are many ways other ways of doing it.
- ;
- ;You need to find out which is the best for your game. I won't be using
- ;this in mine, as mine has no map/smooth scroll.
- ;
- ; YOU need to have amigalibs.res resident, and bb2objtypes.res resident
- ; for this to work, and the fastgfx routines too.
- WBStartup:DEFTYPE.w
-
- #FGFX_COMPACT=0
-
- INCLUDE "FastGfx.bb2"
-
- If InitFastShapes{1}=False Then End
- If MakeBitmap{3,1280,512,5,$10005}=False Then End ;get the super fast bitmap
- If MakeBitmap{2,368,272,5,$10005}=False Then End ;get fast bitmap
- If MakeBitmap{1,336,256,5,$10003}=False Then End ;screen buffer 1
- If MakeBitmap{0,336,256,5,$10003}=False Then End ;screen buffer 2
-
- ;The bitmaps are 16 pixels wider than the screen so that smooth
- ;scrolling can be achived.
-
- ;The fast bitmap has a border of 16 pixels around the main area, to save
- ;time bothering with clipping. We only copy what we can see to the
- ;chip mem bitmap.
-
- LoadBitMap 3,"simple.iff",0
-
- db=1 ; double buffer
-
- rect.Rectangle\MinX=0,0,320,256
-
- Dim scrtags.TagItem(20)
- scrtags(0)\ti_Tag=#SA_Width,336:scrtags(1)\ti_Tag=#SA_Height,256
- scrtags(2)\ti_Tag=#SA_Depth,5:scrtags(3)\ti_Tag=#SA_Type,$F
- scrtags(4)\ti_Tag=#SA_Quiet,True:scrtags(5)\ti_Tag=#SA_ShowTitle,False
- scrtags(6)\ti_Tag=#SA_BitMap,Addr BitMap(0):scrtags(7)\ti_Tag=#SA_DClip,&rect
- scrtags(8)\ti_Tag=#SA_Exclusive,True:scrtags(9)\ti_Tag=#SA_Draggable,False
- scrtags(10)\ti_Tag=#SA_AutoScroll,False:scrtags(11)\ti_Tag=#TAG_DONE,0
-
- ScreenTags 0,"",&scrtags(0):*vp.ViewPort=ViewPort(0):Use Palette 0
-
- x=0:y=0 ;screen x and y positions for top left
- xdir=1:ydir=1 ;random x and y directions
-
- Repeat
- ResetTimer
- xalign=x&$FFF0 ;make xalign the even edge of the scroll
- Gosub COPY_FROM_SUPERBITMAP
- ;do stuff here...like sprites etc
- Gosub DO_STUFF
- ;now copy to a displayable bitmap
- Gosub COPY_FROM_FASTBITMAP
- ;now scroll the vport
- *vp\DxOffset=-(x-xalign)
- Select Ticks
- Case 0:VWait 2
- Case 1:VWait
- End Select
- ShowBitMap db:ScrollVPort_ *vp:db=1-db
- Until Joyb(0)<>0
-
- End
-
- COPY_FROM_SUPERBITMAP:
- xoffset=xalign-16: If xoffset<0 Then xoffset=0
- SetCpuBitmap{2}:SetCpuScrollBitmap{3}:CpuBlockScroll{xoffset,y,368,272,0,0}
- Return
-
- COPY_FROM_FASTBITMAP:
- SetCpuBitmap{db}:SetCpuScrollBitmap{2}:CpuBlockScroll{16,16,336,256,0,0}
- Return
-
- DO_STUFF:
- ;just example, scroll the screen about
- x=x+xdir:y=y+ydir
- If x<0 Then x=0:xdir=1
- If x>892 Then x=892:xdir=-1
- If y<0 Then y=0:ydir=1
- If y>240 Then y=240:ydir=-1
- Return
-
-